package com.victor.dao;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.victor.entity.LoginQuestion;
import com.victor.entity.User;
import com.victor.entity.UserBankcard;

@Mapper
public interface UserDao {

	// openid 查询
	@Select({ "select * from `user` where openid=#{openid}" })
	User wechart(String openid);

	/**
	 * 添加
	 * 
	 * @param user
	 * @return
	 */
	boolean insertSelective(User user);

	@Select({ "select * from `user` where qqopenid=#{qqopenid}" })
	User qq(String qqopenid);

	@Select({ "select * from `user` where id=#{id}" })
	User selById(Integer id);

	/**
	 * 账号登录
	 * 
	 * @param mailbox
	 * @param password
	 * @return
	 */
	User mailLogin(@Param("account") String mailbox, @Param("password") String password);
	/**
	 * 根据手机号查询
	 * @param mobile
	 * @return
	 */
	@Select({"select * from `user` where phone=#{mobile}"})
	User selByPhone(String mobile);
	/**
	 * 根据账号查询
	 * @param account
	 * @return
	 */
	@Select({"select * from `user` where BINARY account=#{account}"})
	User selByAccount(String account);
	/**
	 * 根据mail查询
	 * @param mail
	 * @return
	 */
	@Select({"select * from `user` where BINARY mailbox=#{mail}"})
	User selByMail(String mail);
	/**
	 * 修改
	 * @param user
	 * @return
	 */
	boolean updateByPrimaryKeySelective(User user);
	/**
	 * 查询银行卡
	 * @param id
	 * @return
	 */
	@Select({"select * from user_bankcard where userid=#{id}"})
	List<UserBankcard> selBankCardByUid(Integer id);
	/**
	 * 查询遇到的问题
	 * @return
	 */
	@Select({"select * from loginquestion"})
	List<LoginQuestion> selLoginQuestion();

}
